Skip to content

Conversation

vlad-perevezentsev
Copy link
Contributor

@vlad-perevezentsev vlad-perevezentsev commented Aug 13, 2025

This PR suggests adding dpnp.linalg.lu_factor() for 2D arrays similar to scipy.linalg.lu_factor
Support for ND inputs will be added in the next phase.

In addition, this PR includes:

  1. An updated implementation of getrf to support non-square matrices.
  2. Refactoring of _lu_factor() by splitting the logic into separate functions to improve readability and maintainability.
  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?

Copy link
Contributor

github-actions bot commented Aug 13, 2025

View rendered docs @ https://intelpython.github.io/dpnp/index.html

Copy link
Contributor

github-actions bot commented Aug 13, 2025

Array API standard conformance tests for dpnp=0.19.0dev3=py313h509198e_30 ran successfully.
Passed: 1227
Failed: 0
Skipped: 9

@coveralls
Copy link
Collaborator

coveralls commented Aug 13, 2025

Coverage Status

coverage: 72.184% (+0.06%) from 72.126%
when pulling 66c0803 on impl_lu_factor
into 875bf78 on master.

Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vlad-perevezentsev vlad-perevezentsev merged commit 6eb6f6f into master Aug 28, 2025
69 of 88 checks passed
@vlad-perevezentsev vlad-perevezentsev deleted the impl_lu_factor branch August 28, 2025 08:46
github-actions bot added a commit that referenced this pull request Aug 28, 2025
This PR suggests adding `dpnp.linalg.lu_factor()` for 2D arrays similar
to `scipy.linalg.lu_factor`
Support for ND inputs will be added in the next phase.

In addition, this PR includes:

1. An updated implementation of `getrf` to support non-square matrices.
2. Refactoring of `_lu_factor()` by splitting the logic into separate
functions to improve readability and maintainability. 6eb6f6f
vlad-perevezentsev added a commit that referenced this pull request Aug 29, 2025
This PR suggests extending `dpnp.linalg.lu_factor()` #2557 for batch
arrays

In addition, this PR includes:
An updated implementation of getrf_batch to support non-square
matrices
github-actions bot added a commit that referenced this pull request Aug 29, 2025
This PR suggests extending `dpnp.linalg.lu_factor()` #2557 for batch
arrays

In addition, this PR includes:
An updated implementation of getrf_batch to support non-square
matrices d975818
@antonwolfy antonwolfy added this to the 0.19.0 release milestone Aug 29, 2025
Comment on lines +922 to +923
Whether to overwrite data in `a` (may increase performance)
Default: ``False``.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        Whether to overwrite data in `a` (may increase performance).

        Default: ``False``.

check_finite : {None, bool}, optional
Whether to check that the input matrix contains only finite numbers.
Disabling may give a performance gain, but may result in problems
(crashes, non-termination) if the inputs do contain infinities or NaNs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


        Default: ``True``.

Returns
-------
lu :(M, N) dpnp.ndarray
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sems space is missing: lu : (M, N)

lu :(M, N) dpnp.ndarray
Matrix containing U in its upper triangle, and L in its lower triangle.
The unit diagonal elements of L are not stored.
piv (K, ): dpnp.ndarray
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

piv : (K, ) dpnp.ndarray

return dpnp_lstsq(a, b, rcond=rcond)


def lu_factor(a, overwrite_a=False, check_finite=True):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation for the function is not rendering

if any(dev_info_h):
diag_nums = ", ".join(str(v) for v in dev_info_h if v > 0)
warn(
f"Diagonal number {diag_nums} are exactly zero. Singular matrix.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Diagonal number {diag_nums} is exactly zero. Singular matrix."

a_h.get_array(),
ipiv_h.get_array(),
dev_info_h,
depends=[copy_ev] if copy_ev is not None else [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It must depend on _manager.submitted_events if copy is None

vlad-perevezentsev added a commit that referenced this pull request Sep 4, 2025
This PR suggests adding `dpnp.linalg.lu_factor()` for 2D arrays similar
to `scipy.linalg.lu_factor`
Support for ND inputs will be added in the next phase.

In addition, this PR includes:

1. An updated implementation of `getrf` to support non-square matrices.
2. Refactoring of `_lu_factor()` by splitting the logic into separate
functions to improve readability and maintainability.
vlad-perevezentsev added a commit that referenced this pull request Sep 4, 2025
This PR suggests extending `dpnp.linalg.lu_factor()` #2557 for batch
arrays

In addition, this PR includes:
An updated implementation of getrf_batch to support non-square
matrices
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants